<html xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui" >  

    <ui:composition template="layout.xhtml">
        <ui:define name="corpo">
            <h:form id="criarAcesso_form" acceptcharset="utf-8"> 
                <div id="breadcrumb">
                    <p:commandLink  actionListener="#{managerIndex.redirect('index.xhtml')}" value="Inicio" update="@form" immediate="true"/> >
                    <p:commandLink  actionListener="#{managerIndex.redirect('config.xhtml')}" value="Configurações" update="@form" immediate="true"/> >
                    <p:commandLink  value="Usuário" update="@form" immediate="true"/>
                </div>
                <p:panel header="Principal - Usuário">
                    <bconfr/>
                    <h:panelGrid style="float: right;" columns="4">
                        <p:graphicImage url="/media/img/new.png" title="Cadastrar Usuário" /> <p:commandLink   value="Cadastrar" title="Cadastrar Usuário" actionListener="#{managerUsuario.redirect('criarUsuario.xhtml')}" update="@form"/>
                        <!--                        <p:graphicImage url="/media/img/search.png" title="Pesquisar Usuário"/><p:commandLink value="Pesquisar" title="Pesquisar Usuário"  actionListener="{managerUsuario.pesquisarUsuario()}" update="@form"/>-->
                    </h:panelGrid>
                    <br/>
                    <br/>
                    <p:dataTable id="funcUsuario" var="user" value="#{managerVisualizarUsuario.usuarios}"
                                 paginator="true" rows="5"
                                 paginatorPosition="bottom"
                                 paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}"  
                                 rowsPerPageTemplate="5,10,15">    
                        <f:facet name="header">  
                            Nível de Acesso 
                        </f:facet>
                        <p:column  style="width:5px;" >  
                            <p:rowToggler/>
                        </p:column>
                        <p:column  style="width:350px;" >  
                            <f:facet name="header"  >   
                                Nome   
                            </f:facet>  
                            <h:outputText value="#{user.nome}"  />  
                        </p:column>
                        <p:column style="width:200px;">  
                            <f:facet name="header" >   
                                Login   
                            </f:facet>  
                            <h:outputText value="#{user.login}"  />  
                        </p:column>

                        <p:column style="width:70px;" headerText="Opções">  
                            <p:commandButton  icon="editar" title="Editar Usuário" actionListener="#{managerEditarUsuario.redirect('editarUsuario.xhtml', user)}"  update="@form" />
                            <p:commandButton  icon="transferir"  title="Alterar Senha" actionListener="#{managerEditarUsuario.redirectLogin('editarLogin.xhtml', user)}"  update="@form" />
                            <p:commandButton  icon="view" title="Visualizar Usuário Selo" actionListener="#{managerVisualizarUsuario.redirect('visualizarUsuario.xhtml', user)}"  update="@form" />
                       
                        </p:column>
                        <p:rowExpansion>
                            <h:outputLabel value="Permissão de Acesso" />
                            <ol>
                                <ui:repeat value="#{user.grupos}" var="grp">
                                    <li><h:outputLabel value="#{grp.descricao}" /></li>
                                </ui:repeat>
                            </ol>

                        </p:rowExpansion>
                    </p:dataTable> 

                 


                </p:panel>
            </h:form>
        </ui:define>
    </ui:composition>

</html>